﻿using System;
#if TASKSUPPORT
using System.Threading.Tasks;
#else
using MugenMvvmToolkit.Models;
#endif

namespace MugenMvvmToolkit.Interfaces
{
#if TASKSUPPORT
    /// <summary>
    ///     Represents an interface that is responsible for handling exceptions in the task.
    /// </summary>
    public interface ITaskExceptionHandler
    {
        /// <summary>
        ///     Handles an exception.
        /// </summary>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="status">The specified task status.</param>
        /// <param name="exception">The specified exception to handle.</param>
        void Handle(object sender, TaskStatus status, Exception exception);
    }
#else
    /// <summary>
    ///     Represents an interface that is responsible for handling exceptions in the <see cref="IOperationResult"/>.
    /// </summary>
    public interface IOperationExceptionHandler
    {
        /// <summary>
        ///     Handles an exception.
        /// </summary>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="status">The specified task status.</param>
        /// <param name="exception">The specified exception to handle.</param>
        void Handle(object sender, OperationStatus status, Exception exception);
    }
#endif
}